package com.nny;

import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

public class Test03 {
    public static void main(String[] args) throws IOException {
        String date="hello";
        FileOutputStream BufferedWriter = new FileOutputStream("3.txt");
        byte[] bytes = date.getBytes();
        BufferedWriter.write(bytes);


        FileInputStream BufferedRead = new FileInputStream("3.txt");
        byte [] buffer = new byte[1024];
        StringBuilder conten=new StringBuilder();
        int length;
        while ((length = BufferedRead.read(buffer))!=-1){
            conten.append(new String(buffer,0,length, StandardCharsets.UTF_8));
        }
        System.out.println(conten.toString());
    }
}
